<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

    <title>{{username}}的主页</title>
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <link rel="stylesheet" href="/static/css/global.css">

    <link href="https://cdn.bootcss.com/twitter-bootstrap/3.4.1/css/bootstrap-theme.min.css" rel="stylesheet">
    <link href="https://cdn.bootcss.com/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">

    <script src="https://cdn.bootcss.com/jquery/3.4.1/core.js"></script>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
    <script src="https://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.js"></script>

    <script src="https://cdn.bootcss.com/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
    <script src="https://cdn.bootcss.com/twitter-bootstrap/3.4.1/js/npm.js"></script>

    <script src="https://cdn.bootcss.com/socket.io/2.3.0/socket.io.js"></script>
</head>

<body style="margin: 0 1em;">
    <nav class="navbar navbar-default">
        <div class="container navbar-left">
            <div class="navbar-header">
                <img src="/static/favicon.ico" alt="图标" class="navbar-brand">
            </div>

            <ul class="nav navbar-nav">
                <li class="active"><a href="#">你好，{{username}}</a></li>
                <li><a href="/file_list">多文件上传</a></li>
                <li><a href="/doc">查看帮助文档</a></li>
                <li><a href="/view_file">查看服务器文件</a></li>
                <li><a href="/terminal_debug" target="_blank">假的终端页面</a></li>
                <li><a href="/terminal_actual" target="_blank">真的终端页面</a></li>
            </ul>

            <form action="/home" method="POST" class="navbar-form navbar-right">
                <div class="input-group">
                    <input type="submit" name="logout" id="logout" class="btn btn-danger" value="退出登录">
                </div>
            </form>
        </div>
    </nav>

    <div class="panel-group" id="articles">
        {%for art in articles%}
        <div class="panel panel-warning">
            <div class="panel-heading">
                <div class="panel-title">
                    <a href="#art_{{art.id}}" data-toggle="collapse" data-parent="#articles">
                        <h4>{{art.title}}</h4>
                    </a>
                </div>
                <p>
                    修改时间：{{art.edit_time}} <br>
                    创建时间：{{art.create_time}}
                </p>
            </div>

            <div class="panel-collapse collapse" id="art_{{art.id}}">
                <hr>
                <p>
                    {% if length(art.content) > 100 %}
                        {{ art.content[0:99] + '...' }}
                    {% else %}
                        {{art.content}}
                    {% endif %}
                </p>
                <hr>

                <div class="row">
                    <div class="col-md-1">
                        <a href="/edit?title={{art.title}}&id={{art.id}}" class="btn btn-info">编辑文章</a>
                    </div>

                    <div class="col-md-1">
                        <a href="/upload?id={{art.id}}&title={{art.title}}" class="btn btn-info">上传至终端</a>
                    </div>
                </div>


            </div>
        </div>
        {%endfor%}
    </div>

    <a href="/edit" class="btn btn-primary" style="display: block;">新建文章</a>

</body>

</html>
